babl: fix bug in icc tag alignment
authorØyvind Kolås <pippin@gimp.org>
Mon, 9 Jul 2018 14:29:42 +0000 (16:29 +0200)
committerØyvind Kolås <pippin@gimp.org>
Mon, 9 Jul 2018 14:29:46 +0000 (16:29 +0200)
babl/babl-icc.c

index ed6e0ccb87b920d73fbed0efe86a82a49e83859f..9d520b976fce9e16cfacdbc8d03e338dc0b3ff23 100644 (file)
@@ -392,7 +392,10 @@ static const Babl *babl_trc_from_icc (ICC  *state, int offset,
 
 static void icc_allocate_tag (ICC *state, const char *tag, int size)
 {
-    state->no+=((4-state->o)%4);state->o = state->no;state->psize = size;
+    while (state->no % 4 != 0)
+      state->no++;
+
+    state->o = state->no;state->psize = size;
     icc_write (sign, 128 + 4 + 4 * state->headpos++, tag);
     icc_write (u32,  128 + 4 + 4 * state->headpos++, state->o);
     icc_write (u32,  128 + 4 + 4 * state->headpos++, size);